package school.domain;

import java.io.Serializable;

public class Student implements Serializable{
	private String studentId;
	private String studentName;
	private String studentAddress;
	private int studentYear;
	private int studentClass;
	private int studentNo;
	private int schoolId;
	private School school;
	public Student(String studentId, String studentName, String studentAddress,
			int studentYear, int studentClass, int studentNo, int schoolId,
			School school) {
		this.studentId = studentId;
		this.studentName = studentName;
		this.studentAddress = studentAddress;
		this.studentYear = studentYear;
		this.studentClass = studentClass;
		this.studentNo = studentNo;
		this.schoolId = schoolId;
		this.school = school;
	}
	public Student(String studentId, String studentName, String studentAddress,
			int studentYear, int studentClass, int studentNo, int schoolId) {
		this.studentId = studentId;
		this.studentName = studentName;
		this.studentAddress = studentAddress;
		this.studentYear = studentYear;
		this.studentClass = studentClass;
		this.studentNo = studentNo;
		this.schoolId = schoolId;
	}
	
	public Student(){}
	public String getStudentId() {
		return studentId;
	}
	public void setStudentId(String studentId) {
		this.studentId = studentId;
	}
	public String getStudentName() {
		return studentName;
	}
	public void setStudentName(String studentName) {
		this.studentName = studentName;
	}
	public String getStudentAddress() {
		return studentAddress;
	}
	public void setStudentAddress(String studentAddress) {
		this.studentAddress = studentAddress;
	}
	public int getStudentYear() {
		return studentYear;
	}
	public void setStudentYear(int studentYear) {
		this.studentYear = studentYear;
	}
	public int getStudentClass() {
		return studentClass;
	}
	public void setStudentClass(int studentClass) {
		this.studentClass = studentClass;
	}
	public int getStudentNo() {
		return studentNo;
	}
	public void setStudentNo(int studentNo) {
		this.studentNo = studentNo;
	}
	public int getSchoolId() {
		return schoolId;
	}
	public void setSchoolId(int schoolId) {
		this.schoolId = schoolId;
	}
	public School getSchool() {
		return school;
	}
	public void setSchool(School school) {
		this.school = school;
	}
	@Override
	public String toString() {
		return "Student [studentId=" + studentId + ", studentName="
				+ studentName + ", studentAddress=" + studentAddress
				+ ", studentYear=" + studentYear + ", studentClass="
				+ studentClass + ", studentNo=" + studentNo + ", schoolId="
				+ schoolId + ", school=" + school + "]";
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((school == null) ? 0 : school.hashCode());
		result = prime * result + schoolId;
		result = prime * result
				+ ((studentAddress == null) ? 0 : studentAddress.hashCode());
		result = prime * result + studentClass;
		result = prime * result
				+ ((studentId == null) ? 0 : studentId.hashCode());
		result = prime * result
				+ ((studentName == null) ? 0 : studentName.hashCode());
		result = prime * result + studentNo;
		result = prime * result + studentYear;
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Student other = (Student) obj;
		if (school == null) {
			if (other.school != null)
				return false;
		} else if (!school.equals(other.school))
			return false;
		if (schoolId != other.schoolId)
			return false;
		if (studentAddress == null) {
			if (other.studentAddress != null)
				return false;
		} else if (!studentAddress.equals(other.studentAddress))
			return false;
		if (studentClass != other.studentClass)
			return false;
		if (studentId == null) {
			if (other.studentId != null)
				return false;
		} else if (!studentId.equals(other.studentId))
			return false;
		if (studentName == null) {
			if (other.studentName != null)
				return false;
		} else if (!studentName.equals(other.studentName))
			return false;
		if (studentNo != other.studentNo)
			return false;
		if (studentYear != other.studentYear)
			return false;
		return true;
	}
}
